import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/yb_chinese_text/yb_chinese_text.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBJsonToModel/YBWorkTaiModel/YBWorkTaiReMenModel.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBWorkTaiModule/YBFenXiangHuKePage/YBBaseProvider/YBBaseProvider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBWorkTaiModule/YBFenXiangHuKePage/YBHuKeSubPage/YBHuKeSmallImageSubPage.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBWorkTaiModule/YBFenXiangHuKePage/YBHuKeSubPage/YBHuKeTitleSubPage.dart';

class YBFenXiangZuZhiWenZhangPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Scaffold(
        appBar: AppBar(
          elevation: 0,
          title: Text(YBChineseText.workTaiZuZhiWenZhangContent,style: YBTextStyle.TextStyle30313320Medium,),
        ),
        body:ChangeNotifierProvider(
            create:(context)=>YBZuzhiWenZhangWenZhangProvider()..getzuZhiDataList(1),
            child: Consumer<YBZuzhiWenZhangWenZhangProvider>(
                builder:(context,zuZhiList,child){

                 return SmartRefresher(
                   controller: zuZhiList.easyRefreshController,
                   onLoading: () async {
                     zuZhiList.loadData();
                   },
                   onRefresh: () async {
                     zuZhiList.refreshData();
                   },
                   enablePullDown: true,
                   enablePullUp: true,
                   child:CustomScrollView(
                     slivers: [
                       SliverList(
                         delegate: SliverChildBuilderDelegate((_,int index){
                           YBWorkTaiRemenModel workRemModel = zuZhiList.zuZhiModelList[index];
                           return YBHukeSmallImageSubPage(reMenModel: workRemModel,);
                         },childCount: zuZhiList.zuZhiModelList.length),
                       ),
                     ],
                   ),
                 );
                }
            ),
        ),
      ),
    );
  }
}
